#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> arr(n);
	for (size_t i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr.begin(), arr.end());
	int ret = INT_MAX;
	for (size_t i = 0; i < n - 1; i++)
		ret = ret > arr[i + 1] - arr[i] ? arr[i + 1] - arr[i] : ret;
	cout << ret;
}